package com.ostrich.module_home.discovery.adapter.provider

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.provider.BaseItemProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ostrich.module_home.databinding.HomeItemBriefCardViewBinding
import com.ostrich.module_home.discovery.entity.DiscoveryEntity

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/30 15:08
 * @Description : BriefCardProvider
 */
class BriefCardProvider(override val itemViewType: Int, override val layoutId: Int) :BaseItemProvider<DiscoveryEntity>() {

    override fun onViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        DataBindingUtil.bind<HomeItemBriefCardViewBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: DiscoveryEntity) {
        helper.getBinding<HomeItemBriefCardViewBinding>()?.viewModel  = item
        helper.getBinding<HomeItemBriefCardViewBinding>()?.executePendingBindings()
    }
}